package Teacher_Test.TestIO;

import java.io.*;

public class IOtest {
    public static void main(String[] args) {
        try {
            ObjectOutputStream objectOutputStream= new ObjectOutputStream(new FileOutputStream("D://test1.txt"));
            objectOutputStream.writeObject(new Animal("season",1));
            objectOutputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        try {
            ObjectInputStream objectInputStream =new ObjectInputStream(new FileInputStream("D://test.txt"));
            Animal animal = (Animal) objectInputStream.readObject();
            System.out.println(animal.toString());
            objectInputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        }


    }
}
